#ifndef FRAGMENTWIDGET_H
#define FRAGMENTWIDGET_H

#include"ui_fragment.h"
#include<QValidator>

#include "serialize/fragment.h"

namespace Ui{
class FragmentWidget;
}

class FragmentWidget : public QWidget
{
    Q_OBJECT

public:
    explicit FragmentWidget(QWidget* p=0);
    ~FragmentWidget();

    inline void setWorkPath(QString s){workPath = s;}
    inline void setFilePath(QString s){filePath = s;}
    Fragment getFragmentFromUI();
    void displayFragmentToUI(Fragment& f);
    Fragment readFragmentFromFile();
    bool saveFragmentToFile();
    void clearUI();

    static void exportToBinary(QString workspacepath);
    static void exportToXML(QString workspacepath);
    static void importFromXML(QString workspacepath,QString xmlFile);

    Ui::FragmentWidget* ui;
private:
    QString workPath;
    QString filePath;
    void setInputMask();
};

#endif // FRAGMENTWIDGET_H
